﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using 访问权限修饰符1;

namespace 访问权限修饰符1
{
    public class TestClass1
    {

    }

}

namespace 访问权限修饰符
{
    class Animal
    {
        public string _name = "动物";
        private int _age;
        public Animal() { }

        public string Name { get => _name; set => _name = value; }
        public int Age { get => _age; set =>  _age = value; }

        public virtual void Test()
        {
            Console.WriteLine($"{_name}在吃东西");
        }

        public void Sleep() 
        {
            Console.WriteLine($"{_name}在睡觉");
        }
    };

    class Cat : Animal
    {
        private string _name = "鸟";
        public Cat() { }
        public void Test()
        {
            //Console.WriteLine($"{Name}正在吃东西");
            Console.WriteLine(_name);
            CatchingMouse();

            Console.WriteLine(base._name);
            base.Test();
        }

        public void CatchingMouse()
        {
            Console.WriteLine($"{Name}在抓老鼠");
        }
    };
    class Dog : Animal
    {
        public Dog() { }
        public void cry()
        {
            Console.WriteLine($"{Name}在叫");
        }
    };
    internal abstract class Person
    {
        public abstract void Play();
    }
    class Zs : Person
    {
        public override void Play()
        {
            Console.WriteLine("Zs 重写的play方法");
        }
        public void Eat()
        {
            Console.WriteLine("Zs 中独有的方法");
        }
    };
    class Ls : Person
    {
        public override void Play()
        {
            Console.WriteLine("Ls 重写的play方法");
        }
    };
    class Ww : Person
    {
        public override void Play()
        {
            Console.WriteLine("Ww 重写的play方法");
        }
    };
    class TestClass
    {
        public void Test(Person person)
        {
            person.Play();
        }
    }

    class A
    {
        public virtual void Test()
        {
            Console.WriteLine("可以进行重写的方法");
        }
    }

    class B : A
    {
        public override void Test()
        {
            Console.WriteLine("B重写的方法");
        }
        public void Test1()
        {
            Console.WriteLine("B所特有的方法");
        }
    }

    class C : B
    {
        public override void Test()
        {
            Console.WriteLine("C重写的方法");
            base.Test();
        }
    }

    internal class Program
    {
        static void Main(string[] args)
        {
            //TestClass testClass = new TestClass();
            //TestClass1 testClass2 = new TestClass1();

            //Cat c = new Cat();
            //c.Name = "小花";
            //c.Age = 3;
            //c.Eat();
            //c.Sleep();
            //c.CatchingMouse();
            //Console.WriteLine();

            //Dog dog = new Dog();
            //dog.Name = "旺财";
            //dog.Age = 2;
            //dog.Eat();
            //dog.Sleep();
            //dog.cry();

            //Cat cat = new Cat();
            //cat.Test();

            //TestClass test = new TestClass();
            //Zs z = new Zs();
            //Ls l = new Ls();
            //Ww w = new Ww();
            //test.Test(z);
            //test.Test(l);
            //test.Test(w);

            //C c = new C();
            //c.Test();
            //c.Test1();
            //Console.ReadKey(true);

            Person person = new Zs();
            person.Play();

            Zs zs = new Zs();
            person = zs;
        }
    }
}
